package com.eeepay.eeepay_v2.adapter;

import android.content.Context;
import android.graphics.Color;

import com.eeepay.eeepay_v2.R;
import com.eeepay.eeepay_v2.model.PersonInfo;
import com.eeepay.v2_library.adapter.ABBaseAdapter;
import com.eeepay.v2_library.adapter.ABViewHolder;

import java.util.Objects;

/**
 * Created by zw on 2016/3/15 0015.
 */
public class PersonListAdapter extends ABBaseAdapter<PersonInfo>{

    public PersonListAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_person_list;
    }

    @Override
    public void convert(ABViewHolder holder, PersonInfo model) {
        holder.setRightText(R.id.lrt_name, model.getName());
        holder.setRightText(R.id.lrt_phone, model.getPhone());
        holder.setRightText(R.id.et_email, model.getEmail());
        holder.setRightText(R.id.lrt_role, model.getRole());
        if("正常".equals(model.getState())){
            holder.setRightText(R.id.lrt_state, model.getState()).setRightTextColor(R.color.green);
        }else{
            holder.setRightText(R.id.lrt_state, model.getState()).setRightTextColor(R.color.red);
        }
    }

    public PersonInfo getData(int position){
        return list.get(position);
    }
}
